\name{compare}
\alias{compare}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{Compare Functions}
\description{Compare the timings and results of multiple functions on the same dataset.  Designed to help choose the "most efficient" set of code.
}
\usage{
compare(data, functions)
}
\arguments{
  \item{data}{\code{data} will be passed as the first argument to each of the functions.  As long as the functions can use the format, it does not matter what type of data it is.
}
  \item{functions}{\code{functions} should be a character vector of the names of functions to be compared.  \code{compare} will iterate through calling each function on \code{data}, record the timings, and test that the results are equal.
}
}
%% \details{}
\value{
  Prints TRUE to the console if all results from the functions are equal.

  Returns a named list of the same length as the vector of functions passed, with their appropriate names.  Each element contains the results of \code{system.time} for the given function and data.
}
%% \references{}
\author{Joshua Wiley, \url{http://joshuawiley.com/}}

\note{I wrote this when I was testing various functions trying to find the fastest, and have not used it much since, so it has had little testing beyond a few very simple cases.
}

%% \seealso{}
\examples{
## a function to compare
foo <- function(x) {sum(x)/length(x)}

## sample data
set.seed(10); dat <- rnorm(10000)

## compare the timings
compare(dat, c("mean", "foo"))

rm(dat, foo)
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{utilities}
